package com.wondertek.service.service.business;

import com.baomidou.mybatisplus.extension.service.IService;
import com.github.pagehelper.PageInfo;
import com.wondertek.service.dto.app.req.AppDevicePageByUserIdReq;
import com.wondertek.service.dto.app.res.AppDeviceNumByUserIdRes;
import com.wondertek.service.dto.app.res.AppDevicePageByUserIdRes;
import com.wondertek.service.dto.business.req.*;
import com.wondertek.service.dto.business.res.DeviceAllRes;
import com.wondertek.service.dto.business.res.DevicePageRes;
import com.wondertek.service.dto.business.res.SiteDeviceAccessoryRes;
import com.wondertek.service.dto.business.res.TimeZoneDictRes;
import com.wondertek.service.entity.business.AccessoryPo;
import com.wondertek.service.entity.business.DevicePo;
import com.wondertek.service.sdk.iotdh.dto.req.ModifyWirelessNetwork;
import com.wondertek.service.sdk.iotdh.dto.req.utc.SetDeviceUTCTimezoneReq;
import com.wondertek.service.sdk.iotdh.dto.res.network.AroundWirelessNetwork;
import com.wondertek.service.sdk.iotdh.dto.res.network.GetCurrentWirelessNetworkRes;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @description: 设备管理接口
 * @author: qinjianhui
 * @create: 2024-07-18 10:11
 **/
public interface DeviceService extends IService<DevicePo> {

    /*
    * 网关设置布防
    * */
    void networkSetMode(DeviceNetworkSetModeReq req);

    /*
     * 根据用户ID查询设备
     * */
    AppDeviceNumByUserIdRes numByUserId(AppDevicePageByUserIdReq req);

    /*
    * 根据用户ID查询设备
    * */
    PageInfo<AppDevicePageByUserIdRes> pageByUserId(AppDevicePageByUserIdReq req);

    /*
    * 查询未租赁的设备
    * */
    PageInfo<DevicePo> selectNotRentaldevice(DevicePageReq req);

    /*
    * 新增
    * */
    void addDevice(DeviceAddReq deviceAddReq);

    /*
    * 删除
    * */
    void deleteDevice(String id);

    /*
    * 分页查询
    * */
    PageInfo<DevicePageRes> page(DevicePageReq devicePageReq);

    /*
     * 导出设备
     * */
    void exportDevice(DevicePageReq devicePageReq, HttpServletResponse response);

    /*
    * 修改
    * */
    void updateDevice(DeviceUpdateReq updateReq);

    /**
     * 根据站点id查询所有网关设备
     * @param siteId
     * @return
     */
    List<DeviceAllRes> findAllGatewayBySiteId(String siteId);

    /*
    * 查询所有网关设备
    * */
    List<DeviceAllRes> findAllGateway(String siteId,String userId);

    /*
     * 查询站点设备信息
     * */
    SiteDeviceAccessoryRes selectSiteDevice(DevicePo devicePo);

    /*
     * 查询站点设备配件信息
     * */
    SiteDeviceAccessoryRes selectSiteDeviceAccessory(AccessoryPo accessoryPo);


    /**
     * 设备重启
     * @param deviceSn
     */
    void deviceRestart(String deviceSn);

    /**
     * 查询时区字典
     * @return
     */
    List<TimeZoneDictRes> findTimeZoneDict(String search);

    /**
     * 搜索设备时区
     * @param deviceSn
     * @return
     */
    TimeZoneDictRes findDeviceTimeZone(String deviceSn);

    /**
     * 设置报警网关所在时区
     *
     * @param req
     */
    void setDeviceUTCTimezone(SetDeviceUTCTimezoneReq req);

    /**
     * 修改网关设备密码
     * @param req
     */
    void modifyDevicePassword(ModifyDevicePasswordReq req);


    /**
     * 配置有线网络
     * @param networkInfoReq
     */
    void setNetworkInfo(NetworkInfoReq networkInfoReq);


    /**
     * 查询有线网络
     * @param deviceSn
     * @return
     */
    NetworkInfoReq findNetworkInfo(String deviceSn);


    /**
     * 查询网关正在使用的wifi信息
     * @param deviceSn
     * @return
     */
    GetCurrentWirelessNetworkRes findUseWifi(String deviceSn);

    /**
     * 查询网关附近的wifi信息
     * @param deviceSn
     * @return
     */
    List<AroundWirelessNetwork> findNearbyWifi(String deviceSn);

    /**
     * 连接wifi
     * @param modifyWirelessNetwork
     */
    void connectWifi(ModifyWirelessNetwork modifyWirelessNetwork);

    // 设置蜂窝网络
    void setCellularNetwork(String deviceSn, boolean status);

    // 查询蜂窝网络
    boolean findCellularNetwork(String deviceSn);

    /**
     * 配件状态检测
     * @param deviceSn
     * @return
     */
    AccessoryStatusDetectionSumReq findAccessoryStatus(String deviceSn, Integer pageNo, Integer pageSize);

    Integer findModeByDeviceSn(String deviceSn);
}

